//
//  UIButton+extension.swift
//  SUNweibo
//
//  Created by sighting on 16/8/21.
//  Copyright © 2016年 sighting. All rights reserved.
//

import UIKit

extension UIButton{

    
    func setImageWithBackgroundImage(imageName:String,backgroundImageName:String) -> UIButton {
        
        let bnt = UIButton()
        bnt.setImage(UIImage(
                            named:"tabbar_"+imageName)?.withRenderingMode(.alwaysOriginal),
                            for: .normal)
        bnt.setImage(UIImage(
                            named:"tabbar_"+imageName+"_highlighted")?.withRenderingMode(.alwaysOriginal),
                            for: .highlighted)
        bnt.setBackgroundImage(UIImage(
                            named:"tabbar_"+backgroundImageName),
                            for: .normal)
        bnt.setBackgroundImage(UIImage(
                            named:"tabbar_"+backgroundImageName+"_highlighted"),
                            for: .highlighted)
        
        return bnt
    }

}
